<?php
namespace Food\Controller;

class UserController extends \Common\Controller\BaseController{

	public function order(){
		$wap = I('wap');
		$Orders=D('Foodorder');// 实例化User对象
		$orderlist=$Orders->select();

		$map['uid'] = $this->user['uid'];
		$map['otel'] = $this->user['usertel'];
		$map['_logic'] = 'OR';

		$count      = $Orders->where($map)->count();// 查询满足要求的总记录数
		$Page       = new \Com\Page($count,10);// 实例化分页类 传入总记录数和每页显示的记录数

		// 进行分页数据查询 注意limit方法的参数要使用Page类的属性
		$orderlist = $Orders->relation(true)->where($map)->order('oid desc')->limit($Page->firstRow.','.$Page->listRows)->select();
				
		$data = array(
			'orderlist' => $orderlist,
			'page' => $Page->show(),
		);
		$this->assign($data);// 赋值分页输出
		if ($wap == 1) {
			$this->display("User_wap_order");
		}else{
			$this->display();
		}
	}
}